//===============================
//  功能 ：备注 
//  作者 ：上中野辅亚瑟王 
//  创建时间 ：2025-11-02  14-49-53 
//  Unity版本  ：2019.4.35f1 
//  变更时间 :  2025-11-02  14-49-53 
//===============================





// 功法类
[System.Serializable]
public class Gongfa
{
    public string name;
    public GongfaType type;
    public GongfaElement element;
    public GongfaRarity rarity;
    public GongfaTraits traits;

    public int level;
    public float power;
    public float cost;
    public float cooldown;

    public string description;

    // 计算综合评分
    public float GetScore()
    {
        float baseScore = power * 0.5f + (10 - cost) * 0.3f + (10 - cooldown) * 0.2f;
        float rarityMultiplier = 1f + (int)rarity * 0.25f;
        float traitsBonus = GetTraitsCount() * 0.1f;

        return baseScore * rarityMultiplier * (1f + traitsBonus);
    }

    private int GetTraitsCount()
    {
        int count = 0;
        foreach (GongfaTraits trait in System.Enum.GetValues(typeof(GongfaTraits)))
        {
            if (trait != GongfaTraits.None && traits.HasFlag(trait))
                count++;
        }
        return count;
    }
}
